import { createRouter, createWebHashHistory } from "vue-router";
import LayOut from "@/LayOut";
const routes = [
  {
    path: "/",
    name: "layout",
    component: LayOut,
    children: [
      {
        path: "/",
        redirect: "/dashBoard",
      },
      {
        path: "/dashBoard",
        name: "仪表盘",
        meta: {
          menus: [],
        },
        component: () => import("@v/DashBoard"),
      },
      {
        path: "/itemLists",
        name: "商品列表",
        meta: {
          menus: [
            {
              name: "商品",
              path: "/itemLists",
            },
          ],
        },
        component: () => import("@v/ItemLists"),
      },
      {
        path: "/itemAdd",
        meta: {
          menus: [
            {
              name: "商品",
              path: "/itemLists",
            },
            {
              name: "商品列表",
              path: "/itemLists",
            },
          ],
        },
        name: "增加商品",
        component: () => import("@v/ItemAdd"),
      },
      {
        path: "/itemUpdate",
        name: "修改商品",
        meta: {
          menus: [
            {
              name: "商品",
              path: "/itemLists",
            },
            {
              name: "商品列表",
              path: "/itemLists",
            },
          ],
        },
        component: () => import("@v/ItemUpdate"),
      },
      {
        path: "/cateLists",
        name: "商品分类列表",
        meta: {
         menus: [
            {
              name: "商品",
              path: "/itemLists",
            },
          ],
        },
        component: () => import("@v/CateLists"),
      },
      {
        path: "/userInfo",
        name: "个人中心",
        meta: {
          menus: [],
        },
        component: () => import("@v/UserInfo"),
      },
      {
        path: "/settings",
        name: "设置",
        meta: {
          menus: [],
        },
        component: () => import("@v/Settings"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@v/Login"),
  },
  {
    path: "/:pathMatch(.*)*",
    name: "notFound",
    component: () => import("@v/NotFound"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
